package com.itheima.stringbuilder;

public class Demo1StringBuilder {
    public static void main(String[] args) {
        //获取当前系统时间所对应的毫秒值,通常用来测试程序耗时,测试性能
        long start = System.currentTimeMillis();
        StringBuilder sb = new StringBuilder();
        for(int i = 1;i <= 50000;i++){
            sb.append(i);
        }
        System.out.println(sb);
        long end = System.currentTimeMillis();
        System.out.println(end - start);
        method();
    }

    public static void method() {
        long start = System.currentTimeMillis();
        String s = "";
        for(int i = 1;i <= 50000;i++){
            s+=i;
        }
        System.out.println(s);
        long end = System.currentTimeMillis();
        System.out.println(end - start);
    }
}
